package com.example.demo.entity;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.CreationTimestamp;

import javax.persistence.*;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;

/**
 * @author zjj
 * @date 2021-04-15
 * 用户信息
 */
@Entity
@Table(name = "t_student")
@Getter
@Setter
public class Student implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @NotNull(groups = Update.class)
    private Long id;

//    针对字符串进行判空处理，是字符串去除空格.trim()之后的判断
    @NotBlank(message = "姓名不能为空")
    @Column(name = "stu_name")
    private String stuName;

    private int sex;

    private int age;

    @Column(name = "class_room")
    private String classRoom;

    @Column(name = "stu_code")
    private String stuCode;

    private String major;

    @Column(name = "id_card")
    private String idCard;

    @Column(name = "create_id")
    private Long createId;

    @Column(name = "create_time")
    @CreationTimestamp
    private Timestamp createTime;

    @Column(name = "update_id")
    private Long updateId;

    @Column(name = "update_time")
    @CreationTimestamp
    private Timestamp updateTime;

    public @interface Update{}
}
